
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 02/05/2011 13:26:42
-- Generated from EDMX file: C:\TFS\RN\anael\anael.Data\Model\Model.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [anael];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------


-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'PersonneSet'
CREATE TABLE [dbo].[PersonneSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [nbrContact] smallint  NOT NULL,
    [sexe] smallint  NOT NULL,
    [nbrPhoto] smallint  NOT NULL,
    [status] smallint  NOT NULL,
    [nbrGroupe] smallint  NOT NULL,
    [Categorie_Id] int  NOT NULL
);
GO

-- Creating table 'CategorieSet'
CREATE TABLE [dbo].[CategorieSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [nom] nvarchar(max)  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'PersonneSet'
ALTER TABLE [dbo].[PersonneSet]
ADD CONSTRAINT [PK_PersonneSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'CategorieSet'
ALTER TABLE [dbo].[CategorieSet]
ADD CONSTRAINT [PK_CategorieSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Categorie_Id] in table 'PersonneSet'
ALTER TABLE [dbo].[PersonneSet]
ADD CONSTRAINT [FK_PersonneCategorie]
    FOREIGN KEY ([Categorie_Id])
    REFERENCES [dbo].[CategorieSet]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_PersonneCategorie'
CREATE INDEX [IX_FK_PersonneCategorie]
ON [dbo].[PersonneSet]
    ([Categorie_Id]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------